package com.xz.danhuaapi.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xz.danhuaapi.common.IdRequest;
import com.xz.danhuaapi.model.dto.interfaceinfo.InterfaceInfoAddRequest;
import com.xz.danhuaapi.model.dto.interfaceinfo.InterfaceInfoInvokeRequest;
import com.xz.danhuaapi.model.dto.interfaceinfo.InterfaceInfoQueryRequest;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xz.danhuaapi.model.vo.InterfaceInfoVO;
import com.xz.danhuaapicommon.model.entity.InterfaceInfo;

import javax.servlet.http.HttpServletRequest;

/**
* @author xuzhou
* @description 针对表【interface_info(接口信息)】的数据库操作Service
* @createDate 2024-07-04 14:46:33
*/
public interface InterfaceInfoService extends IService<InterfaceInfo> {
    /**
     * 校验
     *
     * @param interfaceInfo
     * @param add
     */
    void validInterfaceInfo(InterfaceInfo interfaceInfo, boolean add);

    /**
     * 获取查询条件
     *
     * @param interfaceInfoQueryRequest
     * @return
     */
    QueryWrapper<InterfaceInfo> getQueryWrapper(InterfaceInfoQueryRequest interfaceInfoQueryRequest);

    /**
     * 获取接口封装
     *
     * @param interfaceInfo
     * @return
     */
    InterfaceInfoVO getInterfaceInfoVO(InterfaceInfo interfaceInfo);

    /**
     * 分页获取
     *
     * @param interfaceInfoPage
     * @param request
     * @return
     */
    IPage<InterfaceInfoVO> getInterfaceInfoVOPage(Page<InterfaceInfo> interfaceInfoPage, HttpServletRequest request);

    /**
     * 添加接口信息
     *
     * @param interfaceInfoAddRequest
     * @param request
     * @return
     */
    long addInterfaceInfo(InterfaceInfoAddRequest interfaceInfoAddRequest, HttpServletRequest request);

    /**
     * 上线接口信息
     *
     * @param id
     * @return
     */
    boolean onlineInterfaceInfo(Long id);

    /**
     * 下线接口信息
     *
     * @param id
     * @return
     */
    boolean offlineInterfaceInfo(Long id);


    /**
     * 调用接口
     *
     * @param interfaceInfoInvokeRequest
     * @param request
     * @return
     */
    Object invokeInterfaceInfo(InterfaceInfoInvokeRequest interfaceInfoInvokeRequest,
                               HttpServletRequest request);
}
